package org.smr.ministore.service.impl;

import java.util.List;

import org.blade.utils.Pager;

import org.smr.ministore.dao.OrganAuthorityMapper;
import org.smr.ministore.entities.OrganAuthority;
import org.smr.ministore.service.OrganAuthorityService;

import org.springframework.beans.factory.annotation.Autowired;


import org.springframework.stereotype.Service;

@Service("OrganAuthorityService")
public class OrganAuthorityServiceImpl implements OrganAuthorityService {

	@Autowired
	private OrganAuthorityMapper mapper;
	
	public int save(OrganAuthority entity) {
		return mapper.insert(entity);
	}

	public int updateById(OrganAuthority id) {
		return mapper.updateById(id);
	}

	public OrganAuthority queryById(Long id) {
		return mapper.selectById(id);
	}

	public int deleteById(Long id) {
		return mapper.deleteById(id);
	}

	public Pager<OrganAuthority> paginate( OrganAuthority entity, Long pageSize, Long pageNum) {

		Pager<OrganAuthority> pager = new Pager( pageSize, pageNum );
		List list  = mapper.pagination(entity, pager);
		pager.setEntities(list);
		return pager;
    }
	
	public int batchSave(List<OrganAuthority> entities) {
		return mapper.batchInsert(entities);
	}

}
